import request from '@/utils/request'
import * as proxy from '@/constants/proxy'

//下拉字典数据
export function getSelectData(code: any) {
  return request({
    url: proxy.CHECC_API_CMS + `/kjsl/common/getDictByCode/${code}`,
    method: 'get',
  })
}

//部门单位字典数据
export function getUnitData(data: any) {
  return request({
    url: proxy.CHECC_API_CMS + '/kjsl/common/getOrgsByLoginUser',
    method: 'get',
  })
}

//部门人员字典数据
export function getPersonnelData(data: any) {
  return request({
    url: proxy.CHECC_API_CMS + '/kjsl/common/getUsers',
    method: 'post',
    data
  })
}

//文件下载
export function downloadFiles(id: any) {
  return request({
    url: `/fastDfs/file_info/${id}`,
    method: 'get'
  })
}

//文件删除
export function delectFiles(id: any) {
  return request({
    url: `/fastDfs/file_info/${id}`,
    method: 'delete'
  })
}



// 列表数据
export function getList(data: any) {
  return request({
    url: proxy.CHECC_API_CMS + '/kjsl/hplatform/list',
    method: 'post',
    data
  })
}

//批量删除
export function getDelect(ids: any) {
  return request({
    url: proxy.CHECC_API_CMS + `/kjsl/hplatform/${ids}`,
    method: 'delete',
  })
}

//新增基础信息
export function getAdd(data: any) {
  return request({
    url: proxy.CHECC_API_CMS + '/kjsl/hplatform/add',
    method: 'post',
    data
  })
}

//修改数据
export function getUpdate(data: any) {
  return request({
    url: proxy.CHECC_API_CMS + '/kjsl/hplatform/update',
    method: 'post',
    data
  })
}

//获取详情
export function getDetail(id: any) {
  return request({
    url: proxy.CHECC_API_CMS + `/kjsl/hplatform/getDetailById/${id}`,
    method: 'get',
  })
}


//新增人员
export function getAddPeople(data: any) {
  return request({
    url: proxy.CHECC_API_CMS + '/kjsl/hplatform/addMember',
    method: 'post',
    data
  })
}

//删除人员
export function delectPeople(id: any) {
  return request({
    url: proxy.CHECC_API_CMS + `/kjsl/hplatform/disAssociation/member/${id}`,
    method: 'get'
  })
}

//项目关联
export function addProject(data: any) {
  return request({
    url: proxy.CHECC_API_CMS + '/kjsl/hplatform/addProject',
    method: 'post',
    data
  })
}

//取消项目关联
export function delectProject(id: any) {
  return request({
    url: proxy.CHECC_API_CMS + `/kjsl/hplatform/disAssociation/project/${id}`,
    method: 'get'
  })
}

//上传附件
export function addFiles(data: any) {
  return request({
    url: '/kjsl/hplatform/addFile',
    method: 'post',
    data
  })
}

